package com.dfbz.文件上传;

import java.io.*;
import java.net.Socket;

public class client {
    public static void main(String[] args) throws IOException {
        //连接服务器
        Socket socket = new Socket("192.168.2.166", 6666);
        OutputStream outputStream = socket.getOutputStream();
        FileInputStream fileInputStream = new FileInputStream(new File("C:\\Users\\admin\\Desktop\\2021892.jpg"));
        int len;
        byte[] data=new byte[1024];
        while ((len=fileInputStream.read(data))!=-1){
            outputStream.write(data,0,len);
        }
    }
}
